set more on
cd "/Users/gehlbach/Documents/Data/Businessman Candidates/Replication"
use businessmen_candidates.dta, clear

/* regression output */

# delimit;

global output "table2.xls";
global controls "party_strngth extract rep ao lnpop lmincome_pc incumbent_ran n";

xi: dprobit bcgr5 free_media99 $controls i.a_year, cl(id); 
outreg using $output, nolabel se bdec(3) 3aster bracket addstat("pseudo R-sqrd", e(r2_p),"# clusters (regions)" ,e(N_clust)) replace;
more;

xi: dprobit bcgr10 free_media99 $controls i.a_year, cl(id); 
outreg using $output, nolabel se bdec(3) 3aster bracket append  addstat("pseudo R-sqrd", e(r2_p),"# clusters (regions)" ,e(N_clust));
more;
xi: dprobit bcgr5 governm_tr $controls i.a_year, cl(id); 
outreg using $output, nolabel se bdec(3) 3aster bracket append  addstat("pseudo R-sqrd", e(r2_p),"# clusters (regions)" ,e(N_clust));
more;

xi: dprobit bcgr10 governm_tr $controls i.a_year, cl(id); 
outreg using $output, nolabel se bdec(3) 3aster bracket append  addstat("pseudo R-sqrd", e(r2_p),"# clusters (regions)" ,e(N_clust));
more;

xi: dprobit bcgr5 free_media99 x_extr_med $controls i.a_year , cl(id) ;
outreg using $output, nolabel bdec(3) se 3aster bracket append  addstat("pseudo R-sqrd", e(r2_p),"# clusters (regions)" ,e(N_clust)); 
more;

xi: dprobit bcgr10 free_media99 x_extr_med $controls i.a_year , cl(id) ;
outreg using $output, nolabel bdec(3) se 3aster bracket append  addstat("pseudo R-sqrd", e(r2_p),"# clusters (regions)" ,e(N_clust)); 
more;

xi: dprobit bcgr5 gov x_extr_gov $controls i.a_year, cl(id) ;
outreg using $output, nolabel bdec(3) se 3aster bracket append  addstat("pseudo R-sqrd", e(r2_p),"# clusters (regions)" ,e(N_clust)); 
more;

xi: dprobit bcgr10 gov x_extr_gov $controls i.a_year, cl(id) ;
outreg using $output, nolabel bdec(3) se 3aster bracket append  addstat("pseudo R-sqrd", e(r2_p),"# clusters (regions)" ,e(N_clust)); 
more;

xi: dprobit bcgr5 x_extr_party $controls i.a_year , cl(id);
outreg using $output, nolabel bdec(3) se 3aster bracket append  addstat("pseudo R-sqrd", e(r2_p),"# clusters (regions)" ,e(N_clust)); 
more;

xi: dprobit bcgr10 x_extr_party $controls i.a_year , cl(id);
outreg using $output, nolabel bdec(3) se 3aster bracket append  addstat("pseudo R-sqrd", e(r2_p),"# clusters (regions)" ,e(N_clust)); 
more;

/* summary statistics */;

# delimit; 

dprobit bcgr5 $controls;
log using tabs.txt, text replace;
tab bc;
tab bcgr5; 
tab bcgr10;
tab bc if e(sample);
tab bcgr5 if e(sample); 
tab bcgr10 if e(sample);
sum governm_tr free_media99 extract $controls if e(sample);
log close;




